<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <script>
        document.getElementsByTagName('html')[0].style.fontSize = '15px'
    </script>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="./css/common.css">
    <link rel="stylesheet" href="./css/icon.css">
    <link rel="stylesheet" href="./css/mint.min.css">
    <!-- 先引入 Vue -->
    <script src="js/vue.min.js"></script>
    <!-- 引入组件库 -->
    <script src="js/mint.min.js"></script>
    <!--web请求-->
    <script src="js/webservice.js"></script>
    <title> </title>
</head>
<body>
<div class="bgcolor" id="app">
    <div v-for="(itm,idx) in resultDetail" :key="itm.oeordId"
         class="bgwhite padding5 marginT2">
        <div class="flexHL">
            <div v-if="itm.resultAbFlag == 'H'" class="height30 width30 marginT5 radius20 base64_ic_highvalue"></div>
            <div v-if="itm.resultAbFlag == 'L'" class="height30 width30 marginT5 radius20 base64_ic_lowvalue"></div>
            <div v-if="itm.resultAbFlag == 'M'||itm.resultAbFlag == 'A'" class="height30 width30 marginT5 radius20 base64_ic_positive"></div>
            <div class="font17 fontBold marginT5 marginL10">{{itm.resultName}}</div>
            <div class="flexHR flexG">
                <div :class="getClassColor(itm.resultAbFlag)">{{itm.resultValue}}</div>
            </div>
        </div>
        <div class="flexHR matchW marginT5">
            <div class="font12 gray2">{{itm.resultRefRanges}}</div>
        </div>
    </div>
</div>
</body>
<script>
    new Vue({
        el: '#app',
        data: {
            oeordId:"",
            orderName:"",
            resultDetail:[],
        },
        mounted() {
            //将要给原生调用的方法挂载到 window 上面
            window.Config = this.Config
            window.getScanMsg = this.getScanMsg
            window.GetLabResult = this.GetLabResult
            this.oeordId = this.GetQueryString('oeordId');
            this.orderName = this.GetQueryString('orderName');
            console.log(this.oeordId +" "+this.orderName)
            document.title = this.orderName ; //网页改变title
            this.Config()
            this.initData()
        },
        methods: {
            //获取配置
            Config() {
                var content = JSON.stringify({
                    title: this.orderName,
                })
                if (window.android) {
                    window.android.callAndroid(content, "config");
                }
            },
            //获取扫码
            getScanMsg(scanInfo) {
                this.$toast(scanInfo)
            },
            GetLabResult(data) {
                Http.hideLoading(this)
                this.resultDetail=data.resultDetail
            },
            initData() {
                var params = {
                    oeoreId: this.oeordId,
                }
                Http.showLoading(this)
                Http.postPlus("GetLabResult", params, (data) => {
                    console.log(data)
                    this.GetLabResult(data);
                })
            },
            GetQueryString(name) {
                console.log(name);
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
                var r = window.location.search.substr(1).match(reg);
                if (r != null) {
                    if(r[2].indexOf('%') > -1) {
                        var rStr= r[2].replace(/%/g,'%25')
                        return decodeURI(rStr);
                    }
                    return decodeURI(r[2]);
                }
                return null;
            },
            getClassColor(sta) {
                if (sta == "H"||sta == "L"||sta == "M"||sta == "A") {
                  return "padding5 radiusTRBL5 center font15 marginR10 red"
                }
                return "padding5 radiusTRBL5 center font15 marginR10"
            }
        }
    })

</script>

</html>